<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" th:href="@{/assets/css/colorbox.css}" />
<head th:include="fragments/head::header" />
<style>
    .error {
        color: #F00
    }
</style>
<body>
<div th:include="fragments/top::top"></div>
<div class="main-container" id="main-container">
    <div class="main-container-inner">
        <div th:include="fragments/left::left" class="sidebar" id="sidebar"></div>
        <div class="main-content">
            <div class="page-content">
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">
                            <div class="col-xs-12">
                                <h3 class="header smaller lighter blue">基本费用列表</h3>
                                <div class="table-header">
                                    <!--<button type="button" id="addFee" class="btn btn-info  " style="margin-left: 894px">添加费用</button>-->
                                    <button type="button" id="backFee"  onclick="backFee()" class="btn btn-info " style="margin-left: 989px">院校申请列表</button>
                                </div>
                                <form class="basicCost_form">
                                    <input type="hidden" name="basicApplyInfo.id" id="costId" th:value="${basicApplyInfo.id}"/>
                                    <!--<input type="hidden" name="id" id="costId" th:value="${#httpServletRequest.getParameter('id')}"/>-->
                                    <input type="hidden" name="basicApplyInfo.studentNo" id="studentNo" th:value="${basicApplyInfo.studentNo}"/>
                                    <!--<input type="hidden" name="depositAmount" id="depositAmount" th:value="${#httpServletRequest.getParameter('tuition')}"/>
                                    <input type="hidden" name="registrationFee" id="registrationFee" th:value="${#httpServletRequest.getParameter('registrationFee')}"/>
                                    <input type="hidden" name="tuition" id="tuition" th:value="${#httpServletRequest.getParameter('depositAmount')}"/>
                                    <input type="hidden" name="createTime" id="createTime" th:value="${#httpServletRequest.getParameter('createTime')}"/>
                                    <input type="hidden" name="updateTime" id="updateTime" th:value="${#httpServletRequest.getParameter('updateTime')}"/>-->
                                </form>
                                <div class="table-responsive">
                                    <div id="alert" class="alert alert-success" style="display: none;" role="alert">
                                        <button type="button" class="close" data-dismiss="alert" aria-label="Close">
                                            <span aria-hidden="true">&times;</span>
                                        </button>
                                        <span id="alertText"></span>
                                    </div>
                                    <table id="sample-table-2" class="table table-striped table-bordered table-hover">
                                        <thead>
                                        <tr>
                                            <th>id</th>
                                            <th>学号</th>
                                            <th>学费</th>
                                            <th>注册费</th>
                                            <th>押金</th>
                                            <th>录入时间</th>
                                            <th class="hidden-480" width="200px">操作</th>
                                        </tr>
                                        </thead>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>
                    <!-- /.col -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.page-content -->
        </div>

        <div th:include="fragments/bottom::bottom"></div>
    </div>

    <a href="#" id="btn-scroll-up"
       class="btn-scroll-up btn btn-sm btn-inverse"> <i
            class="icon-double-angle-up icon-only bigger-110"></i>
    </a>
</div>
<!-- /.main-container -->


<div th:include="fragments/js::js"></div>

<script th:src="@{/assets/js/jquery.validate.min.js}"></script>
<script th:src="@{/assets/js/jquery.validate.zh-CN.js}"></script>
<!-- page specific plugin scripts -->
<script th:src="@{/assets/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/business/workTable/fee.js}" charset="UTF-8"></script>
<script th:src="@{/assets/js/jquery.dataTables.bootstrap.js}"></script>
<script th:src="@{/assets/js/date-time/moment.min.js}"></script>
<script th:src="@{/assets/js/temp.js}" charset="UTF-8"></script>
<!--图片查看器-->
<script th:src="@{/assets/js/jquery.colorbox-min.js}"></script>
<script th:src="@{/layer/layer.js}"></script>

<script type="text/javascript">
    var oTable1;
    jQuery(function($) {
        oTable1 = $('#sample-table-2').dataTable({
            "bFilter" : false,//是否使用搜索
            "bProcessing" : true,
            "bDeferRender" : true,//
            "sPaginationType" : "bs_normal",//分页样式
            "bRetrieve" : true,//是否调用后台
            "bServerSide" : true,//是否以后台分页
            "sAjaxSource" : "/cost/basicCostApplylist",//请求路径
            "fnServerData" : function(sSource, aoData, fnCallback) {
                aoData.push(
                    {"name":"id","value":$("#costId").val()},
                    {"name":"deleteStatus","value":false}
                )
                $.ajax({
                    "dataType" : 'json',
                    "type" : "POST",
                    "url" : sSource,
                    "data" : aoData,
                    "success" : fnCallback
                });
            },
            "aaSorting" : [ [ 0, "desc" ] ],
            "bSort":true,
            "aoColumns" : [
                {"sClass": "center", "bVisible": false, "mData": "id"},//此列不显示
                {"sClass": "center", "bSortable": false, "mData": "studentNo"},
                {"sClass": "center", "bSortable": false, "mData": "tuition"},
                {"sClass": "center", "bSortable": false, "mData": "registrationFee"},
                {"sClass": "center", "bSortable": false, "mData": "depositAmount"},
                {"sClass": "center", "bSortable": false, "mData":
                    function (data) {
                        if (data.createTime != null) {
                            return getTimeString_day(new Date(data.createTime))
                        } else {
                            return "";
                        }
                    }
                },
                /*{"sClass": "center", "bSortable": false, "mData":
                    function (data) {
                        if (data.updateTime != null) {
                            return getTimeString_day(new Date(data.updateTime))
                        } else {
                            return "";
                        }
                    }
                },*/
                {"sClass": "center", "bSortable": false, "mData": function (data) {
                    var styleDiv = '<div class="visible-md visible-lg hidden-sm hidden-xs action-buttons">';
                    var edit = '<a href="javascript:void(0);" onclick="toBasicEditPage('+data.id+',\''+data.tuition+'\',\''+data.registrationFee+'\',\''+data.depositAmount+'\')">编辑</a>';
                    /*var deletePage= '<a href="javascript:void(0);" onclick="toDelete(' + data.id + ')">删除</a>';*/
                    var styleDiv_end = '</div>';
                    return styleDiv+edit+styleDiv_end;
                }
                },
            ],
            "oLanguage" : {
                "sLengthMenu" : "每页 _MENU_条 ",
                "sZeroRecords" : "对不起，查询不到任何相关数据",
                "sInfo" : "当前显示 _START_ 到 _END_ 条，共 _TOTAL_ 条记录 ",
                "sInfoEmpty" : "显示 0 到 0 条，共 0 条记录",
                "sInfoFiltered" : "数据表中共为 _MAX_ 条记录)",
                "sProcessing" : "正在加载中...",
                "sSearch" : "搜索",
                "sUrl" : "", //多语言配置文件，可将oLanguage的设置放在一个txt文件中，例：Javascript/datatable/dtCH.txt
                "oPaginate" : {
                    "sFirst" : "第一页",
                    "sPrevious" : " 上一页 ",
                    "sNext" : " 下一页 ",
                    "sLast" : " 最后一页 "
                }
            }
            //多语言配置

        });


        $("#query").click(function() {
            oTable1.fnDraw();
        })

    })
    function toAttachment(attachment){
        window.open(attachment);
    }

    function backFee() {

        window.location.href="/apply?studentNo="+$("#studentNo").val();
    }

    function getTimeString_day(date) {
        var y = date.getFullYear();
        var m = date.getMonth() + 1;
        m = m >= 10 ? m : '0' + m;
        var d = date.getDate();
        d = d >= 10 ? d : '0' + d;
        return y + '-' + m + '-' + d;
    }
</script>
</body>
</html>
